package com.wangshidai;

import java.io.*;

/**
 * 字符流完成文件的复制
 * 读取当前项目下Demo02.java复制到d:\\st0303文件夹下Demo01.java
 */
public class Demo04 {
    public static void main(String[] args) throws IOException {
        File f1=new File("demo0303\\src\\com\\wangshidai\\Demo02.java");
        File f2=new File("d:\\st0303\\"+f1.getName());

        FileInputStream fis=new FileInputStream(f1);//小
        InputStreamReader isr=new InputStreamReader(fis);//中
        BufferedReader br=new BufferedReader(isr);//大

        FileOutputStream fos=new FileOutputStream(f2);//小
        OutputStreamWriter osw=new OutputStreamWriter(fos);//中
        BufferedWriter bw=new BufferedWriter(osw);//大

        String str;
        while ((str=br.readLine())!=null){
            bw.write(str+"\n");
        }


        br.close();
        bw.close();
    }
}
